<?php
/**
 * Created by PhpStorm
 * USER MingTingLiang   QQ 915802070
 * Date 2020-12-14-014   16:40
 */


class ProductDataCenter
{
    public static $objectList = [];


    /**
     * @return array
     */
//    public static function get($k)
//    {
//        return self::$objectList[$k];
//    }

    /**
     * @param array $objectList
     */
    public static function set($k, $v): void
    {
        self::$objectList[$k] = $v;
    }

    public static function remove($k)
    {
        unset(self::$objectList[$k]);
    }

    /**
     * Note:静态魔力函数   ,不存在该方法则调用
     * @param $name
     * @param $arguments
     * @return array
     */
    public static function __callStatic($name, $arguments)
    {
        // TODO: Implement __callStatic() method.
        $arr = [];
        foreach (self::$objectList as $k => $v) {

            if (method_exists($v, $name)) {
                //                (new Dogs())   ->getList()
                $res = $v->$name($arguments);
                if ($res) {
                    $arr[] = $res;
                }
            }
        }
        return $arr;
    }
}